package com.untour.im.codec.protocol.packet.client;

import com.untour.im.codec.protocol.message.body.MessageBody;
import com.untour.im.codec.protocol.serialize.SerializerAlgorithm;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public abstract class BaseResponsePacket<T extends MessageBody> implements ResponsePacket<T> {

    /**
     * 消息操作指令 十六进制 一个消息的开始通常以0x开头
     * 4字节
     */
    private Byte command;

    /**
     * 数据解析类型 和具体业务无关，后续根据解析类型解析data数据
     *
     * @see SerializerAlgorithm
     * 4字节
     */
    private Byte messageType = SerializerAlgorithm.JSON;

    private T messageBody;


    public BaseResponsePacket(Byte command, Byte messageType, T messageBody) {
        this.command = command;
        this.messageType = messageType;
        this.messageBody = messageBody;
    }
}
